package com.itheima.health.controller.mobile;

import com.itheima.health.common.MessageConst;
import com.itheima.health.pojo.dto.MemberLoginDTO;
import com.itheima.health.pojo.result.Result;
import com.itheima.health.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mobile")
@Slf4j
public class LoginController {
    @Autowired
    private LoginService mobileService;


    /**
     * 手机模块-用户手机登录
     *
     * @param dto
     * @return
     */
    @PostMapping("/login/smsLogin")
    public Result smsLogin(@RequestBody MemberLoginDTO dto) {
        log.info("[手机模块-用户手机登录]dto:{}", dto);
        mobileService.smsLogin(dto);
        return new Result(true, MessageConst.SEND_VALIDATECODE_SUCCESS);
    }

    @GetMapping("/test")
    public Result test() {
        return new Result(true, "测试方法");
    }
}
